<?php

class PrintController extends BaseController {


//finished oerder
public function getPrint($id)
{ 
$order = DB::table('sys_order')
          ->join('sys_customer','customer_id','=','order_customer_id')
          ->leftjoin('sys_invoice','invoice_order_id','=','order_id')
          ->where('order_id','=',$id)
          ->first();

 
        if($order->order_name=='idcard'){
          $type = DB::table('sys_order_idcard')
                    ->where('order_idcard_order_id','=',$order->order_id)
                    ->first();
          $kategori = 'ID Card';
          $ordername = 'ID Card ('.$type->order_idcard_quality_name.')';
        }else if($order->order_name=='packaging'){
          $kategori = 'Packaging';
          $ordername = 'Packaging';
        }else if($order->order_name=='brochure'){
          $type = DB::table('sys_order_brochure')
                        ->where('order_brochure_order_id','=',$order->order_id)
                        ->first();
          if($type->order_brochure_type=="brochure"){
          $ordername = 'Brosur (Brosur)';
          }else if($type->order_brochure_type=="envelope"){
          $ordername = 'Brosur (Amplop)';
          }else if($type->order_brochure_type=="flayer"){
          $ordername = 'Brosur (Flayer)';
          }else if($type->order_brochure_type=="letterhead"){
          $ordername = 'Brosur (Kop Surat)';
          }
          $kategori = 'Brosur';

        }else if($order->order_name=='nota'){
          $type = DB::table('sys_order_bill')
                        ->where('order_bill_order_id','=',$order->order_id)
                        ->first();
          $kategori = 'Nota';
          $ordername = $type->order_bill_name;
        }else if($order->order_name=='tshirt'){
           $type = DB::table('sys_order_tshirt')
                        ->join('ref_tshirt_detail','tshirt_detail_id','=','order_tshirt_tshirt_id')
                        ->join('ref_tshirt','tshirt_id','=','tshirt_detail_tshirt_id')
                        ->where('order_tshirt_order_id','=',$order->order_id)
                        ->first();
          $kategori = 'T-Shirt';
          $ordername = 'T-Shirt ('.$type->tshirt_type_of_material.')';
        }
/**
 * Fungsi untuk menerjemahkan suatu angka dalam bentuk bilangan. contoh,
 *
 * <code>
 * terbilang(5); // output 'Lima'
 * terbilang(41); // output 'Empat puluh satu'
 * terbilang(1001); // output 'Seribu satu'
 * </code>
 *
 * @author Rio Astamal <me@rioastamal.net>
 *
 * @param int $angka - Angka yang akan diterjemahkan
 * @return string
 */
function terbilang($angka) {
    $angka = (float)$angka;
    $bilangan = array(
            '',
            'satu',
            'dua',
            'tiga',
            'empat',
            'lima',
            'enam',
            'tujuh',
            'delapan',
            'sembilan',
            'sepuluh',
            'sebelas'
    );
 
    if ($angka < 12) {
        return $bilangan[$angka];
    } else if ($angka < 20) {
        return $bilangan[$angka - 10] . ' belas';
    } else if ($angka < 100) {
        $hasil_bagi = (int)($angka / 10);
        $hasil_mod = $angka % 10;
        return trim(sprintf('%s puluh %s', $bilangan[$hasil_bagi], $bilangan[$hasil_mod]));
    } else if ($angka < 200) {
        return sprintf('seratus %s', terbilang($angka - 100));
    } else if ($angka < 1000) {
        $hasil_bagi = (int)($angka / 100);
        $hasil_mod = $angka % 100;
        return trim(sprintf('%s ratus %s', $bilangan[$hasil_bagi], terbilang($hasil_mod)));
    } else if ($angka < 2000) {
        return trim(sprintf('seribu %s', terbilang($angka - 1000)));
    } else if ($angka < 1000000) {
        $hasil_bagi = (int)($angka / 1000); // karena hasilnya bisa ratusan jadi langsung digunakan rekursif
        $hasil_mod = $angka % 1000;
        return sprintf('%s ribu %s', terbilang($hasil_bagi), terbilang($hasil_mod));
    } else if ($angka < 1000000000) {
 
        // hasil bagi bisa satuan, belasan, ratusan jadi langsung kita gunakan rekursif
        $hasil_bagi = (int)($angka / 1000000);
        $hasil_mod = $angka % 1000000;
        return trim(sprintf('%s juta %s', terbilang($hasil_bagi), terbilang($hasil_mod)));
    } else if ($angka < 1000000000000) {
        // bilangan 'milyaran'
        $hasil_bagi = (int)($angka / 1000000000);
        $hasil_mod = fmod($angka, 1000000000);
        return trim(sprintf('%s milyar %s', terbilang($hasil_bagi), terbilang($hasil_mod)));
    } else if ($angka < 1000000000000000) {                          // bilangan 'triliun'                           
        $hasil_bagi = $angka / 1000000000000;                           
        $hasil_mod = fmod($angka, 1000000000000);                           
        return trim(sprintf('%s triliun %s', terbilang($hasil_bagi), terbilang($hasil_mod)));                       
        } else {                            
        return 'Wow...';                        
       }                   
    }                                      

     ob_start();
?>
<style type="text/css">
<!--
table { vertical-align: top; }
tr    { vertical-align: top; }
td    { vertical-align: top; }
}
-->
</style>
<div style="border: solid 2px #000000;">
    <bookmark title="Lettre" level="0" ></bookmark>
    <table cellspacing="0" style="width: 100%; text-align: center; font-size: 14px">
        <tr>
            <td style="width: 25%; color: #444444;">
                <img style="width: 85%; margin-top:20px; margin-left:20px" src="images/logo.png" alt="Logo"><br>
            </td>
            <td style="width: 50%; color: #444444;">
                <p align="center"><label><b><h3>INVOICE</h3></b></label></p>
            </td>
            <td style="width: 25%; color: #444444;">
            </td>
        </tr>
    </table>
    <hr>
    <hr>
    <table cellspacing="0" style="width: 100%; text-align: left; font-size: 11pt;">
        <tr>
            <td style="width:100%;">
                Jln. Ring Road Timur No. 59 Wonocatur, Banguntapan - Bantul, Yogyakarta<br>
                Telp (0274) 452155<br>
                Email : financestaff@netindosolution.com, finance@netindosolution.com<br>
            </td>
        </tr>
    </table>
    <hr>
        <p style="font-size: 11pt;">Kepada Yth :<br>
        <b><?php echo $order->customer_name ?></b><br>
        Telp <?php echo $order->customer_phone ?><br></p>
    <table cellspacing="0" style="width: 100%; text-align: left; font-size: 11pt;">
        <tr>
            <td style="width:50%;">

            </td>
            <td style="width:25%;">
               NO.SO <?php echo $order->order_code ?>
            </td>
            <td style="width:25%;">
               Kantor
            </td>
        </tr>
    </table>
    <table cellspacing="0" style="width: 100%; border: solid 1px black; text-align: center; font-size: 10pt;">
        <tr>
            <td style="width: 50%; border: solid 1px #000; text-align: left; font-size: 11pt;">
                <table cellspacing="0" style="width: 100%; text-align: left; font-size: 11pt;">
                  <tr>
                      <td style="width:30%;"> No. Invoice</td>
                      <td style="width:2%;">:</td>
                      <td style="width:50%;">INV-06-62/SCI/2014</td>
                  </tr>
                   <tr>
                      <td style="width:30%;"> Kategori</td>
                      <td style="width:2%;">:</td>
                      <td style="width:50%;"><?php echo $kategori; ?></td>
                  </tr>
                   <tr>
                      <td style="width:30%;"> No. Surat Jalan</td>
                      <td style="width:2%;">:</td>
                      <td style="width:50%;">-</td>
                  </tr>
                </table>
            </td>
        
            <td style="width: 25%; border: solid 1px #000; text-align: center; font-size: 11pt;">Tanggal<br>
              <?php echo date("d-M-Y",strtotime($order->order_date)); ?>
            </td>
       
            <td style="width: 25%; border: solid 1px #000; text-align: center; font-size: 11pt;">Jatuh Tempo<br>
              <?php echo date("d-M-Y",strtotime("+5 day",strtotime($order->order_date))); ?></td>
        </tr>
    </table>
    <br>
 <table cellspacing="0" style="width: 100%; border: solid 1px black; text-align: center; font-size: 10pt;">
        <tr>
            <th style="width: 5%; border: solid 1px #000; text-align: center; font-size: 11pt;">No</th>
            <th style="width: 45%; border: solid 1px #000; text-align: center; font-size: 11pt;">Spesifikasi</th>
        
            <th style="width: 12.5%; border: solid 1px #000; text-align: center; font-size: 11pt;">Jumlah</th>
            <th style="width: 12.5%; border: solid 1px #000; text-align: center; font-size: 11pt;">Harga @</th>
       
            <th style="width: 25%; border: solid 1px #000; text-align: center; font-size: 11pt;">Total</th>
        </tr>
        <tr>
            <?php $no=1; ?>
            <td style="border: solid 1px #000; height:50px; text-align: center; font-size: 11pt;"><?php echo $no; ?></td>
            <td style="border: solid 1px #000; height:50px; text-align: left; font-size: 11pt;"><?php echo $ordername; ?></td>
            <td style="border: solid 1px #000; height:50px; text-align: right; font-size: 11pt;"><?php echo $order->order_qty.' '.$order->order_qty_unit; ?></td>
            <td style="border: solid 1px #000; height:50px; text-align: right; font-size: 11pt;">Rp <?php echo number_format($order->invoice_total_payment/$order->order_qty,0,'.','.') ?></td>
            <td style="border: solid 1px #000; height:50px; text-align: right; font-size: 11pt;">Rp <?php echo number_format($order->invoice_total_payment,0,'.','.') ?></td>
        </tr>
    </table>
    <table cellspacing="0" style="width: 100%; border: solid 1px black; text-align: center; font-size: 10pt;">
        <tr>
            <td style="width: 75%; border: solid 1px #000; text-align: center;"><b>Sub Total</b></td>
            <td style="width: 25%; border: solid 1px #000; text-align: right;"> <b>Rp <?php echo number_format($order->invoice_total_payment,0,'.','.') ?></b></td>
        </tr>
        <tr>
            <td style="width: 75%; height:25px; border-bottom: solid 1px #000; text-align: center;">Pembayaran</td>
            <td style="width: 25%; height:25px; border-bottom: solid 1px #000; text-align: right;">-</td>
        </tr>
        <tr>
            <td style="width: 75%; text-align: center;"><b>Total Invoice</b></td>
            <td style="width: 25%; text-align: right;"><b>Rp <?php echo number_format($order->invoice_total_payment,0,'.','.') ?></b></td>
        </tr>
    </table>

     <table cellspacing="0" style="width: 100%; border: solid 1px black; text-align: center; font-size: 10pt;">
        <tr>
            <td style="width: 100%; border: solid 1px #000; text-align: left;"><br>Terbilang :</td>
        </tr>
        <tr>
            <td style="width: 100%; border-bottom: solid 1px #000; text-align: center;"><i># <?php echo terbilang($order->invoice_total_payment) ?> rupiah #</i></td>
        </tr>
        <tr>
            <td style="width: 100%; border-bottom: solid 1px #000; text-align: center;">
                <table cellspacing="0" style="width: 100%; text-align: left; font-size: 11pt;">
                  <tr>
                      <td style="width:20%;  text-align: center;">Pembayaran :</td>
                      <td style="width:60%;  text-align: center;">
                        <table cellspacing="0" style="width: 100%; text-align: left; font-size: 11pt;">
                          <tr>
                              <td style="width:20%;  text-align: center;"><br></td>
                              <td style="width:80%;  text-align: lfet;"><br></td>
                               
                          </tr>
                          <tr>
                              <td style="width:20%;  text-align: center;">1</td>
                              <td style="width:80%;  text-align: lfet;">
                                MANDIRI<br>
                                Cabang Adisucipto Yogyakarta<br>
                                a/n <b>ABDUL KHOLIK</b><br>
                                <b>No. Rek. 137 0005 168030</b>
                              </td>
                          </tr>
                           <tr>
                              <td style="width:20%;  text-align: center;">2</td>
                              <td style="width:80%;  text-align: lfet;">
                                BCA<br>
                                Cabang Yogyakarta<br>
                                a/n <b>ABDUL KHOLIK</b><br>
                                <b>No. Rek. 0372 533542</b>
                              </td>
                          </tr>
                        </table>
                      </td>
                  </tr>
                </table>
            </td>
        </tr>
         <tr>
            <td style="width: 100%; border-bottom: solid 1px #000; text-align: center;">
                Mohon kirimkan konfirmasi pembayaran ke :<br>
                Telp : (0274) 452155 atau email : financestaff@netindosolution.com, finance@netindosolution.com        
            </td>
        </tr>
    </table>
    <nobreak>
        <table cellspacing="0" style="width: 100%; text-align: left;">
            <tr>
                <td style="width:50%; ">
                    Hormat saya,<br>
                    <br>
                    <br>
                    <u>Deny Septiana Anggreani, S.T</u><br>
                    Staff Finance PT. Netindo Solution Group<br>
                </td>
            </tr>
        </table>
    </nobreak>
</div>
<?php
     $content = ob_get_clean();

    // convert to PDF
    require_once('/../print/html2pdf.class.php');
    try
    {
        $html2pdf = new HTML2PDF('P', 'A4', 'en');
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $html2pdf->Output('invoice.pdf');
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }
}


public function getPackagingprice()
{
      $pricelist = DB::table('ref_packaging')
                ->join('ref_papertype','papertype_id','=','packaging_papertype_id')
                ->where('packaging_isdelete',0)
                ->orderby('packaging_papertype_id')
                ->orderby('packaging_type')
                ->get();
     ob_start();
?>
<style type="text/css">
<!--
table { vertical-align: top; }
tr    { vertical-align: top; }
td    { vertical-align: top; }
}
-->
</style>
<div >
    <bookmark title="Lettre" level="0" ></bookmark>
    <table cellspacing="0" style="width: 100%; text-align: center; font-size: 14px">
        <tr>
           
            <td style="width: 25%; color: #444444;">
                <img style="width: 85%; margin-top:0px; margin-left:10px" src="images/logo.png" alt="Logo"><br>
            </td>
            <td style="width: 50%; color: #444444;">
                <br><br><br><p align="center"><label><b><h3>DAFTAR HARGA PACKAGING</h3></b></label></p>
            </td>
            <td style="width: 25%; color: #444444;">
            </td>
        </tr>
    </table>
    <table cellspacing="0" style="width: 100%; text-align: left; font-size: 14px;">

        <tr>
            <th style="width: 5%; color: #444444;border: solid 1px #000000;">
              No
            </th>
            <th style="width: 25%; color: #444444;border: solid 1px #000000;">
              Nama
            </th>
            <th style="width: 35%; color: #444444;border: solid 1px #000000;">
              Jenis kertas
            </th>
            <th style="width: 15%; color: #444444;border: solid 1px #000000;">
              Ukuran (Cm)
            </th>
            <th style="width: 20%; color: #444444;border: solid 1px #000000;">
              Harga
            </th>
        </tr>
  <?php  
  $no = 1;
  foreach($pricelist as $pl){ ?>
        <tr>
             <td style="border: solid 1px #000000;"><?php echo$no ?></td>
             <td style="border: solid 1px #000000;"><?php echo$pl->packaging_type ?></td>
             <td style="border: solid 1px #000000;"><?php echo$pl->papertype_name ?></td>
             <td style="border: solid 1px #000000;"><?php echo$pl->packaging_length.'x'.$pl->packaging_width.'x'.$pl->packaging_height ?></td>
             <td style="border: solid 1px #000000;">Rp <?php echo number_format($pl->packaging_price,0,'.','.').' / '.$pl->packaging_qty_price.' '.$pl->packaging_qty_unit ?></td>
        </tr>
   <?php $no++; 
    }?>
    </table>


</div>
<?php
     $content = ob_get_clean();

    // convert to PDF
    require_once('/../print/html2pdf.class.php');
    try
    {
        $html2pdf = new HTML2PDF('P', 'A4', 'en');
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $html2pdf->Output('packagingprice.pdf');
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }

}

public function getIdcardprice()
{

     $pricelist = refidcardquality::where('idcard_quality_isdelete',0)->get();
     ob_start();
?>
<style type="text/css">
<!--
table { vertical-align: top; }
tr    { vertical-align: top; }
td    { vertical-align: top; }
}
-->
</style>
<div >
    <bookmark title="Lettre" level="0" ></bookmark>
    <table cellspacing="0" style="width: 100%; text-align: center; font-size: 14px">
        <tr>
           
            <td style="width: 25%; color: #444444;">
                <img style="width: 85%; margin-top:0px; margin-left:10px" src="images/logo.png" alt="Logo"><br>
            </td>
            <td style="width: 50%; color: #444444;">
                <br><br><br><p align="center"><label><b><h3>DAFTAR HARGA ID CARD</h3></b></label></p>
            </td>
            <td style="width: 25%; color: #444444;">
            </td>
        </tr>
    </table>
    <table cellspacing="0" style="width: 100%; text-align: left; font-size: 14px;">

        <tr>
            <th style="width: 10%; color: #444444;border: solid 1px #000000;">
              No
            </th>
            <th style="width: 60%; color: #444444;border: solid 1px #000000;">
              Nama
            </th>
            <th style="width: 30%; color: #444444;border: solid 1px #000000;">
              Harga
            </th>
        </tr>
  <?php  
  $no = 1;
  foreach($pricelist as $pl){ ?>
        <tr>
             <td style="border: solid 1px #000000;"><?php echo$no ?></td>
             <td style="border: solid 1px #000000;">ID Card <?php echo$pl->idcard_quality_name ?></td>
             <td style="border: solid 1px #000000;">Rp <?php echo number_format($pl->idcard_quality_price,0,'.','.').' / '.$pl->idcard_quality_qty.' '.$pl->idcard_quality_unit ?></td>
        </tr>
   <?php $no++; 
    }?>
    </table>


</div>
<?php
     $content = ob_get_clean();

    // convert to PDF
    require_once('/../print/html2pdf.class.php');
    try
    {
        $html2pdf = new HTML2PDF('P', 'A4', 'en');
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $html2pdf->Output('idcardprice.pdf');
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }


}

public function getBrochureprice()
{
$pricelist = refbrosur::where('brochure_isdelete',0)->get();
     ob_start();
?>
<style type="text/css">
<!--
table { vertical-align: top; }
tr    { vertical-align: top; }
td    { vertical-align: top; }
}
-->
</style>
<div >
    <bookmark title="Lettre" level="0" ></bookmark>
    <table cellspacing="0" style="width: 100%; text-align: center; font-size: 14px">
        <tr>
           
            <td style="width: 25%; color: #444444;">
                <img style="width: 85%; margin-top:0px; margin-left:10px" src="images/logo.png" alt="Logo"><br>
            </td>
            <td style="width: 50%; color: #444444;">
                <br><br><br><p align="center"><label><b><h3>DAFTAR HARGA BROSUR</h3></b></label></p>
            </td>
            <td style="width: 25%; color: #444444;">
            </td>
        </tr>
    </table>
    <table cellspacing="0" style="width: 100%; text-align: left; font-size: 14px;">

        <tr>
            <th style="width: 5%; color: #444444;border: solid 1px #000000;">
              No
            </th>
            <th style="width: 20%; color: #444444;border: solid 1px #000000;">
              Nama
            </th>
            <th style="width: 40%; color: #444444;border: solid 1px #000000;">
              Jenis kertas
            </th>
            <th style="width: 10%; color: #444444;border: solid 1px #000000;">
              Ukuran
            </th>
            <th style="width: 25%; color: #444444;border: solid 1px #000000;">
              Harga
            </th>
        </tr>
  <?php  
  $no = 1;
  foreach($pricelist as $pl){ ?>
        <tr>
               <td style="border: solid 1px #000000;"><?php echo $no; ?></td>
             <?php if($pl->brochure_type=='brochure'){
              $brosr = DB::table('ref_brochure')
                  ->join('ref_papertype','papertype_id','=','brochure_papertype_id')
                  ->join('ref_size_brochure','size_brochure_size_id','=','brochure_size_id')
                  ->where('brochure_id',$pl->brochure_id)
                  ->first();
                   ?>
             <td style="border: solid 1px #000000;">Brosur</td>
             <td style="border: solid 1px #000000;"><?php echo $brosr->papertype_name.' '.$brosr->brochure_color; ?></td>
             <td style="border: solid 1px #000000;"><?php echo $brosr->size_brochure_name; ?></td>
             <?php }else if($pl->brochure_type=='envelope'){
              $brosr = DB::table('ref_brochure')
                  ->join('ref_papertype','papertype_id','=','brochure_papertype_id')
                  ->join('ref_size_envelope','size_envelope_size_id','=','brochure_size_id')
                  ->where('brochure_id',$pl->brochure_id)
                  ->first();
                   ?>
             <td style="border: solid 1px #000000;">Brosur (Envelope)</td>
             <td style="border: solid 1px #000000;"><?php echo $brosr->papertype_name.' '.$brosr->brochure_color; ?></td>
             <td style="border: solid 1px #000000;"><?php echo $brosr->size_envelope_length.'x'.$brosr->size_envelope_width.' '.$brosr->size_envelope_unit; ?></td>

              <?php }else if($pl->brochure_type=='flayer'){
        $brosr = DB::table('ref_brochure')
                  ->join('ref_papertype','papertype_id','=','brochure_papertype_id')
                  ->join('ref_size_flayer','size_flayer_size_id','=','brochure_size_id')
                  ->where('brochure_id',$pl->brochure_id)
                  ->first();
                   ?>
             <td style="border: solid 1px #000000;">Brossur (Flayer)</td>
             <td style="border: solid 1px #000000;"><?php echo $brosr->papertype_name.' '.$brosr->brochure_color; ?></td>
             <td style="border: solid 1px #000000;"><?php echo $brosr->size_flayer_length.'x'.$brosr->size_flayer_width.' '.$brosr->size_flayer_unit ?></td>
             <?php }else if($pl->brochure_type=='letterhead'){
         $brosr = DB::table('ref_brochure')
                  ->join('ref_papertype','papertype_id','=','brochure_papertype_id')
                  ->join('ref_size_letterhead','size_letterhead_size_id','=','brochure_size_id')
                  ->where('brochure_id',$pl->brochure_id)
                  ->first();
                   ?>
             <td style="border: solid 1px #000000;">Brosur (Letterhead)</td>
             <td style="border: solid 1px #000000;"><?php echo $brosr->papertype_name.' '.$brosr->brochure_color; ?></td>
             <td style="border: solid 1px #000000;"><?php echo $brosr->size_letterhead_name ?></td>
             <?php } ?>
             <td style="border: solid 1px #000000;">Rp <?php echo number_format($pl->brochure_price,0,'.','.').' / '.$pl->brochure_qty_price.' '.$pl->brochure_unit; ?></td>
        </tr>
   <?php $no++; 
    }?>
    </table>


</div>
<?php
     $content = ob_get_clean();

    // convert to PDF
    require_once('/../print/html2pdf.class.php');
    try
    {
        $html2pdf = new HTML2PDF('P', 'A4', 'en');
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $html2pdf->Output('notaprice.pdf');
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }

}

public function getNotaprice()
{
$pricelist = refbill::where('bill_isdelete',0)->get();
     ob_start();
?>
<style type="text/css">
<!--
table { vertical-align: top; }
tr    { vertical-align: top; }
td    { vertical-align: top; }
}
-->
</style>
<div >
    <bookmark title="Lettre" level="0" ></bookmark>
    <table cellspacing="0" style="width: 100%; text-align: center; font-size: 14px">
        <tr>
           
            <td style="width: 25%; color: #444444;">
                <img style="width: 85%; margin-top:0px; margin-left:10px" src="images/logo.png" alt="Logo"><br>
            </td>
            <td style="width: 50%; color: #444444;">
                <br><br><br><p align="center"><label><b><h3>DAFTAR HARGA NOTA</h3></b></label></p>
            </td>
            <td style="width: 25%; color: #444444;">
            </td>
        </tr>
    </table>
    <table cellspacing="0" style="width: 100%; text-align: left; font-size: 14px;">

        <tr>
            <th style="width: 5%; color: #444444;border: solid 1px #000000;">
              No
            </th>
            <th style="width: 25%; color: #444444;border: solid 1px #000000;">
              Nama
            </th>
            <th style="width: 45%; color: #444444;border: solid 1px #000000;">
              Jenis bahan
            </th>
            <th style="width: 25%; color: #444444;border: solid 1px #000000;">
              Harga
            </th>
        </tr>
  <?php  
  $no = 1;
  foreach($pricelist as $pl){ ?>
        <tr>
             <td style="border: solid 1px #000000;"><?php echo$no ?></td>
             <td style="border: solid 1px #000000;">Nota</td>
             <td style="border: solid 1px #000000;"><?php echo$pl->bill_name ?></td>
             <td style="border: solid 1px #000000;">Rp <?php echo number_format($pl->bill_price,0,'.','.').' / '.$pl->bill_qty_price.' '.$pl->bill_qty_unit ?></td>

        </tr>
   <?php $no++; 
    }?>
    </table>


</div>
<?php
     $content = ob_get_clean();

    // convert to PDF
    require_once('/../print/html2pdf.class.php');
    try
    {
        $html2pdf = new HTML2PDF('P', 'A4', 'en');
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $html2pdf->Output('notaprice.pdf');
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }

}

public function getTshirtprice()
{
 $pricelist = DB::table('ref_tshirt')
            ->join('ref_tshirt_detail','tshirt_detail_tshirt_id','=','tshirt_id')
            ->where('tshirt_detail_isdelete',0)
            ->get();
     ob_start();
?>
<style type="text/css">
<!--
table { vertical-align: top; }
tr    { vertical-align: top; }
td    { vertical-align: top; }
}
-->
</style>
<div >
    <bookmark title="Lettre" level="0" ></bookmark>
    <table cellspacing="0" style="width: 100%; text-align: center; font-size: 14px">
        <tr>
           
            <td style="width: 25%; color: #444444;">
                <img style="width: 85%; margin-top:0px; margin-left:10px" src="images/logo.png" alt="Logo"><br>
            </td>
            <td style="width: 50%; color: #444444;">
                <br><br><br><p align="center"><label><b><h3>DAFTAR HARGA T-SHIRT</h3></b></label></p>
            </td>
            <td style="width: 25%; color: #444444;">
            </td>
        </tr>
    </table>
    <table cellspacing="0" style="width: 100%; text-align: left; font-size: 14px;">

        <tr>
            <th style="width: 5%; color: #444444;border: solid 1px #000000;">
              No
            </th>
            <th style="width: 25%; color: #444444;border: solid 1px #000000;">
              Nama
            </th>
            <th style="width: 45%; color: #444444;border: solid 1px #000000;">
              Jenis bahan
            </th>
            <th style="width: 25%; color: #444444;border: solid 1px #000000;">
              Harga
            </th>
        </tr>
  <?php  
  $no = 1;
  foreach($pricelist as $pl){ ?>
        <tr>
             <td style="border: solid 1px #000000;"><?php echo$no ?></td>
             <td style="border: solid 1px #000000;">Tshirt</td>
             <td style="border: solid 1px #000000;"><?php echo$pl->tshirt_type_of_material ?></td>
             <td style="border: solid 1px #000000;">Rp <?php echo number_format($pl->tshirt_detail_price,0,'.','.').' / '.$pl->tshirt_detail_qty_price.' '.$pl->tshirt_detail_qty_unit ?></td>
        </tr>
   <?php $no++; 
    }?>
    </table>


</div>
<?php
     $content = ob_get_clean();

    // convert to PDF
    require_once('/../print/html2pdf.class.php');
    try
    {
        $html2pdf = new HTML2PDF('P', 'A4', 'en');
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $html2pdf->Output('packagingprice.pdf');
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }

}


}
